home *** CD-ROM | disk | FTP | other *** search
- Path: gate.net!pslfl2-8
- From: bhutto@gate.net (William Hutto)
- Newsgroups: comp.lang.c
- Subject: Re: ATTENTION C EXPERTS!! Extern Declarations - NEED HELP!
- Date: 16 Jan 1996 22:17:18 GMT
- Organization: CyberGate, Inc.
- Message-ID: <4dh85e$1b8u@news.gate.net>
- References: <4dcl71$94s@enterprise.sct.gu.edu.au> <4ddf0j$6mb@lyra.csx.cam.ac.uk>
- NNTP-Posting-Host: pslfl2-8.gate.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <4ddf0j$6mb@lyra.csx.cam.ac.uk>,
- 93heb@eng.cam.ac.uk (H.E. Butterworth) wrote:
- >Hi,
- >
- > IMHO
- >
- > cdecl and near are compiler flags which tell the compiler to use the c
- style
- >calling convention (as opposed to pascal style) and that the function is near
- i.e.
- >not to reload the segment registers on function entry. The macros _CDECL and
- >_NEAR just allow you to remove the flags by defining NO_KEYS.
- >
- > I have seen these before only in code for the segmented x86 memory model
- -
- >specifically in exported sections of 16 bit Windows DLLs where an exported
- >function must be declared far and cdecl - I think the compiler would
- otherwise
- >use the pascal calling convention because it is slightly more efficient. 16
- bit
- >Windows code has this stuff scattered all over it.
- >
- > This may be a somewhat garbled version of 'The Truth' but I'm fairly sure
- >it's on the right lines.
- >
- >HB.
-
- It is along the right lines. These keywords are generally used to override any
- defaults. Because libraries of all kinds often times don't come with source
- code, they can't be recompiled with a different calling convention. These
- keywords are used with declarations in their (the libary's) header file(s) so
- the compiler doesn't make the *default* assumption when linking or
- binding which could produce *slightly* faulty code.
-
- Bill
-
- "Whatcha got on?...Your mind?"
-